<!--  -->
<template>
  <div class="">
    <el-row style="margin-top: 20px">
      <el-col :span="4" :offset="1">
        <div class="grid-content bg-purple">
          <el-card class="box-card">
            <div class="text item">
              <el-input placeholder="输入关键字进行过滤" v-model="filterText">
              </el-input>

              <el-tree
                class="filter-tree"
                :data="data"
                :props="defaultProps"
                default-expand-all
                :filter-node-method="filterNode"
                ref="tree"
                style="height:100vh"
              >
              </el-tree>
            </div>
          </el-card></div
      ></el-col>

      <el-col :span="6" :offset="1"
        ><div class="grid-content bg-purple-light">
          <el-card class="box-card">
            <div slot="header" class="clearfix">
              <span>评分</span>
            </div>
            <div class="text item">
              <el-form
                :label-position="labelPosition"
                label-width="80px"
                :model="formLabelAlign"
              >
                <el-form-item label="楼栋号">
                  <el-input v-model="formLabelAlign.name"></el-input>
                </el-form-item>
                <el-form-item label="宿舍号">
                  <el-input v-model="formLabelAlign.region"></el-input>
                </el-form-item>
                <el-form-item label="评分人">
                  <el-input v-model="formLabelAlign.type"></el-input>
                </el-form-item>
                <el-form-item label="基础用法">
                  <el-rate v-model="value" show-text> </el-rate>
                </el-form-item>
                <el-form-item label="基础用法">
                  <el-rate v-model="value" show-text> </el-rate>
                </el-form-item>
                <el-form-item label="基础用法">
                  <el-rate v-model="value" show-text> </el-rate>
                </el-form-item>
                <el-form-item label="基础用法">
                  <el-rate v-model="value" show-text> </el-rate>
                </el-form-item>
                <el-form-item label="基础用法">
                  <el-rate v-model="value" show-text> </el-rate>
                </el-form-item>
                <el-form-item label="基础用法">
                  <el-rate v-model="value" show-text> </el-rate>
                </el-form-item>
                
              </el-form>
            </div>
          </el-card></div
      ></el-col>

      <el-col :span="8" :offset="1">
        <div class="grid-content bg-purple-light">
          <el-card class="box-card">
            <div slot="header" class="clearfix">
              <span>总体排行</span>
            </div>
            <div v-for="o in 4" :key="o" class="text item">
              <span style="display: flex"
                >xxx:
                <el-progress
                  :text-inside="true"
                  :stroke-width="26"
                  :percentage="70"
                  :format="format"
                ></el-progress>
              </span>
              <br />
            </div>
          </el-card>
          <br />   <br />   <br />
          <el-card class="box-card">
            <div slot="header" class="clearfix">
              <span>本次排行</span>
            </div>

            <div v-for="o in 4" :key="o" class="text item">
              <span style="display: flex"
                >xxx:
                <el-progress
                  :text-inside="true"
                  :stroke-width="26"
                  :percentage="70"
                  :format="format"
                ></el-progress>
              </span>
              <br />
            </div>
          </el-card></div
      ></el-col>
    </el-row>
  </div>
</template>

<script>
//这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
//例如：import 《组件名称》 from '《组件路径》';

export default {
  //import引入的组件需要注入到对象中才能使用
  components: {},
  data() {
    //这里存放数据
    return {
      filterText: "",
      data: [
        {
          id: 1,
          label: "一级 1",
          children: [
            {
              id: 4,
              label: "二级 1-1",
              children: [
                {
                  id: 9,
                  label: "三级 1-1-1",
                },
                {
                  id: 10,
                  label: "三级 1-1-2",
                },
              ],
            },
          ],
        },
        {
          id: 2,
          label: "一级 2",
          children: [
            {
              id: 5,
              label: "二级 2-1",
            },
            {
              id: 6,
              label: "二级 2-2",
            },
          ],
        },
        {
          id: 3,
          label: "一级 3",
          children: [
            {
              id: 7,
              label: "二级 3-1",
            },
            {
              id: 8,
              label: "二级 3-2",
            },
          ],
        },
      ],
      defaultProps: {
        children: "children",
        label: "label",
      },
      labelPosition: "right",
      formLabelAlign: {
        name: "",
        region: "",
        type: "",
      },
      value: null,
    };
  },
  //监听属性 类似于data概念
  computed: {},
  //监控data中的数据变化
  watch: {
    filterText(val) {
      this.$refs.tree.filter(val);
    },
  },
  //方法集合
  methods: {
    filterNode(value, data) {
      if (!value) return true;
      return data.label.indexOf(value) !== -1;
    },
    format(percentage) {
      return percentage + "分";
    },
  },
  //生命周期 - 创建完成（可以访问当前this实例）
  created() {},
  //生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {},
  beforeCreate() {}, //生命周期 - 创建之前
  beforeMount() {}, //生命周期 - 挂载之前
  beforeUpdate() {}, //生命周期 - 更新之前
  updated() {}, //生命周期 - 更新之后
  beforeDestroy() {}, //生命周期 - 销毁之前
  destroyed() {}, //生命周期 - 销毁完成
  activated() {}, //如果页面有keep-alive缓存功能，这个函数会触发
};
</script>
<style lang='scss' scoped>
//@import url(); 引入公共css类
.el-progress {
  width: 60%;
}
</style>